package cn.soulfire.advertisement.service.impl;

import cn.soulfire.advertisement.domain.Activity;
import cn.soulfire.advertisement.mapper.ActivityMapper;
import cn.soulfire.advertisement.service.IActivityService;
import cn.soulfire.travel.constants.CommentConstant;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ma.rui.kai
 * @since 2020-10-13
 */
@Service
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements IActivityService {
  @Autowired
  private ActivityMapper activityMapper;
    @Override
    public void disable(Activity activity) {
        if (activity.getState().equals(CommentConstant.COMMENT_DISABLE)){
            activity.setState(CommentConstant.COMMENT_ENABLE);
            activityMapper.updateById(activity);
        }else {
            if(activity.getState().equals(CommentConstant.COMMENT_ENABLE)) {
                activity.setState(CommentConstant.COMMENT_DISABLE);
                activityMapper.updateById(activity);
            }
        }
    }
}

